#include "Zigbee3DataCmd.h"

Zigbee3AcceptDataCmd::Zigbee3AcceptDataCmd(QObject *parent) :
    BaseCmd(parent)
{
    this->m_protocolType = ProtocolType::ZigbeeNewControlProtocol;
    this->m_functionCode = FunctionCode;
}

Package Zigbee3AcceptDataCmd::toPackage()
{
    Package package;
    package.setFunction(FunctionCode);
    return package;
}

void Zigbee3AcceptDataCmd::unPackage(Package package)
{
    QByteArray body = package.body();
    m_body=body;
    m_nwk=body.mid(1,2);
    m_clusterID=body.mid(4,2).toHex().toInt(0,10);
    m_dataType=body.mid(9,1).toHex().toInt(0,10);
    m_yhdata=body.mid(7,1).toHex().toInt(0,10);
    m_coreData=body.mid(11,1).toHex();
//    qDebug()<<"m_coreDataA"<<m_coreData;
//     qDebug()<<"m_coreDataB"<<m_coreData.toHex();
//      qDebug()<<"m_coreDataB"<<m_coreData.toInt(0,10);
}

QByteArray Zigbee3AcceptDataCmd::nwk()const
{
    return m_nwk;
}
void Zigbee3AcceptDataCmd::setNwk(const QByteArray Data)
{
    m_nwk=Data;
}

QByteArray Zigbee3AcceptDataCmd::coreData()const
{
    return m_coreData;
}
void Zigbee3AcceptDataCmd::setCoreData(const QByteArray Data)
{
    m_coreData=Data;
}

quint16 Zigbee3AcceptDataCmd::dataType()const
{
    return m_dataType;
}
void Zigbee3AcceptDataCmd::setDataType(const quint16 Data)
{
    m_dataType=Data;
}

quint16 Zigbee3AcceptDataCmd::clusterID()const
{
    return m_clusterID;
}
void Zigbee3AcceptDataCmd::setClusterID(const quint16 Data)
{
    m_clusterID=Data;
}

QByteArray Zigbee3AcceptDataCmd::Body()const
{
    return m_body;
}


quint16 Zigbee3AcceptDataCmd::yhData()
{
    return m_yhdata;
}
void Zigbee3AcceptDataCmd::setyhdata(quint16 Data)
{
    m_yhdata=Data;
}
